using System;

namespace AuthorizeNET {
	public class CreditCardTransaction : TransactionDetails, INameValueSerializable {

		private TransactionType transaction_type;
		private string card_number;
		private DateTime expiration_date;
		private string card_code;
		private string transaction_id;
		private string authorization_code;
		private string authentication_indicator;
		private string cardholder_authentication_value;

		public CreditCardTransaction(double amount, string currency_code, TransactionType transaction_type, string card_number, DateTime expiration_date, string card_code, string transaction_id, string authorization_code, string authentication_indiciator, string authentication_value)
			: base(amount, currency_code, TransactionMethod.CreditCard) {

			this.transaction_type = transaction_type;
			this.card_number = card_number;
			this.expiration_date = expiration_date;
			this.card_code = card_code;
			this.transaction_id = transaction_id;
			this.authorization_code = authorization_code;
			this.authentication_indicator = authentication_indiciator;
			this.cardholder_authentication_value = authentication_value;
		}

		public CreditCardTransaction()
			: this(0, string.Empty, TransactionType.None, string.Empty, DateTime.MinValue, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty) { }

		[KeyName("x_type")]
		public TransactionType TransactionType {
			get { return (this.transaction_type); }
			set { this.transaction_type = value; }
		}

		[KeyName("x_card_num")]
		public string CardNumber {
			get { return (this.card_number); }
			set { this.card_number = value; }
		}

		[KeyName("x_exp_date")]
		public DateTime ExpirationDate {
			get { return (this.expiration_date); }
			set { this.expiration_date = value; }
		}

		[KeyName("x_card_code")]
		public string CardCode {
			get { return (this.card_code); }
			set { this.card_code = value; }
		}

		[KeyName("x_trans_id")]
		public string TransactionID {
			get { return (this.transaction_id); }
			set { this.transaction_id = value; }
		}

		[KeyName("x_auth_code")]
		public string AuthorizationCode {
			get { return (this.authorization_code); }
			set { this.authorization_code = value; }
		}

		[KeyName("x_authentication_indicator")]
		public string AuthenticationIndicator {
			get { return (this.authentication_indicator); }
			set { this.authentication_indicator = value; }
		}

		[KeyName("x_cardholder_authentication_value")]
		public string CardholderAuthenticationValue {
			get { return (this.cardholder_authentication_value); }
			set { this.cardholder_authentication_value = value; }
		}
	}
}
